home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
pctchnqs
/
1992
/
number2
/
fri13th.bas
< prev
next >
Wrap
BASIC Source File
|
1990-12-15
|
863b
|
21 lines
1 ' Program to predict occurrence of Friday-the-13th.
5 DIM MO$(12)
10 MO$(1)="January" : MO$(2)="February" : MO$(3)="March"
15 MO$(4)="April" : MO$(5)="May" : MO$(6)="June"
20 MO$(7)="July" : MO$(8)="August" : MO$(9)="September"
25 MO$(10)="October" : MO$(11)="November" : MO$(12)="December"
30 INPUT "Enter the year "; YEAR
35 K=13 : ' Day-of-the-month number set to 13th.
40 FRIDAY=5 : ' Day-of-the-week number for Friday.
45 NFLAG=0 : ' Flag is clear if no month is found.
50 PRINT "Months with Friday the 13th for "; YEAR
55 FOR J=1 TO 12
60 IF J<3 THEN M=J+10 : Y=YEAR-1 : ELSE M=J-2 : Y=YEAR
65 D=Y MOD 100 : C=INT(Y/100)
70 Z=(INT((26*M-2)/10)+K+D+INT(D/4)+INT(C/4)-2*C+777) MOD 7
75 IF Z=FRIDAY THEN PRINT MO$(J) : NFLAG=1
80 NEXT J
85 IF NFLAG=0 THEN PRINT "none" : ' In case none found.
90 END